package com.irdstudio.efp.cus.service.impl;

import com.irdstudio.basic.framework.core.base.FrameworkService;
import com.irdstudio.efp.cus.service.dao.AcctInfoGetDao;
import com.irdstudio.efp.cus.service.domain.AcctInfoGet;
import com.irdstudio.efp.cus.service.facade.AcctInfoGetService;
import com.irdstudio.efp.cus.service.vo.AcctInfoGetVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Service Impl: 公积金提取信息表服务实现
 *
 * @author gcb
 * @date 2020-08-11
 */
@Service("acctInfoGetService")
public class AcctInfoGetServiceImpl implements AcctInfoGetService, FrameworkService {

    private static Logger logger = LoggerFactory.getLogger(AcctInfoGetServiceImpl.class);

    @Autowired
    private AcctInfoGetDao acctInfoGetDao;

    /**
     * 新增数据
     *
     * @param acctInfoGetVo
     * @return
     */
    @Override
    public int insert(AcctInfoGetVO acctInfoGetVo) throws Exception {
        AcctInfoGet acctInfoGet = new AcctInfoGet();
        beanCopy(acctInfoGetVo, acctInfoGet);
        return acctInfoGetDao.insert(acctInfoGet);
    }

    /**
     * 根据主键删除信息
     *
     * @param acctInfoGetVo
     * @return
     */
    @Override
    public int deleteByPk(AcctInfoGetVO acctInfoGetVo) throws Exception {
        AcctInfoGet acctInfoGet = new AcctInfoGet();
        beanCopy(acctInfoGetVo, acctInfoGet);
        return acctInfoGetDao.deleteByPk(acctInfoGet);
    }

    /**
     * 根据主键更新信息
     *
     * @param acctInfoGetVo
     * @return
     */
    @Override
    public int updateByPk(AcctInfoGetVO acctInfoGetVo) throws Exception {
        AcctInfoGet acctInfoGet = new AcctInfoGet();
        beanCopy(acctInfoGetVo, acctInfoGet);
        return acctInfoGetDao.updateByPk(acctInfoGet);
    }

    /**
     * 根据主键查询详情
     *
     * @param inAcctInfoGetVo
     * @return
     */
    @Override
    public AcctInfoGetVO queryByPk(AcctInfoGetVO inAcctInfoGetVo) throws Exception {
        AcctInfoGet queryAcctInfoGet = new AcctInfoGet();
        beanCopy(inAcctInfoGetVo, queryAcctInfoGet);
        AcctInfoGet queryRslAcctInfoGet = acctInfoGetDao.queryByPk(queryAcctInfoGet);
        return beanCopy(queryRslAcctInfoGet, new AcctInfoGetVO());
    }
}
